package thinkingInJava.Exception_;
import static thinkingInJava.YTool.YPrint.*;

public class Ex2 {
	private static Integer i = null;	
	public static void main(String[] args) {
		// leads to NullPointerException:
		// Println(i.toString());
		try {
			println(i.toString());
		} catch(NullPointerException e) {
			System.err.println("Caught NullPointerException_");
			e.printStackTrace();
		} 
		try {
			i = 10;
			println(i.toString());
		} catch(NullPointerException e) {
			System.err.println("Caught NullPointerException");
			e.printStackTrace();
		} finally {
			println("Got through it");
		}
	}	
}
